//
//  LandmarkRow.swift
//  codelabs
//
//  Created by 雷雷 on 23/05/2025.
//

import SwiftUI


struct LandmarkRow: View {
    var landmark:Landmark
    
    var body: some View {
        HStack{
            landmark.image.resizable()
                .frame(width: 48,height: 48)
                .scaledToFit()
                .cornerRadius(8)
            
            Text(landmark.name)
                .font(.title2)
            
            Spacer()
            
            if landmark.isFavorite {
                Image(systemName: "star.fill")
                    .foregroundStyle(.yellow)
            }
        }
    }
}

#Preview {
    let landmarks=ModelData().landmarks
    return Group{
        LandmarkRow(landmark: landmarks[0])
        LandmarkRow(landmark: landmarks[1])
        LandmarkRow(landmark: landmarks[2])
    }
}

